package com.two.shopping.mapper;

import com.two.shopping.pojo.Commodity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IAdminMapper {
    //删除商品
    @Delete("delete from  commodity where id=#{id}")
    void deleteId(Integer id);

    //修改商品信息
    void update(Commodity commodity);

    @Select("select  * from commodity ")
    List<Commodity> AllList();
    //模糊查询商品

    List<Commodity> pageLike(String name, Integer state, Integer commodityTypeId);

    //批量删除
    void deletes(List<Integer> ids);

    @Insert("INSERT INTO commodity (name, commodity_type_id, image, price, quantity,state, produce_date, expiration_date, create_time, update_time) values(name =#{name}, commodity_type_id =#{commodityTypeId}, image =#{image}, price =#{price}, quantity =#{quantity}, state =#{state}, produce_date =#{produceDate}, expiration_date =#{expirationDate}, create_time =#{createTime}, update_time =#{updateTime})")

    void add(Commodity commodity);

}